
package com.fiill.audioplayer.filelist;

import android.content.Context;
import android.database.Cursor;

import androidx.loader.content.AsyncTaskLoader;
import java.io.File;

public class PathCursorLoader extends AsyncTaskLoader<Cursor> {
    private final File mPath;

    public PathCursorLoader(Context context, String path) {
        super(context);
        mPath = new File(path).getAbsoluteFile();
    }

    @Override
    public Cursor loadInBackground() {
        File[] file_list = mPath.listFiles();
        return new PathCursor(mPath, file_list);
    }

    @Override
    protected void onStartLoading() {
        forceLoad();
    }
}
